Welcome in the PCTG R Markdown template. Here are a few lines of code and text to give an overview of how R Markdown works.

1 Loading data


Let’s load a GWAS summary statistic stored in the qqman library. This library is:

  • Made by Stephen Turner
  • Good to plot a quick Manhattan plot
library(qqman)

2 Show data in a table


library(DT)
datatable(gwasResults, rownames = FALSE, filter="top", options = list(pageLength = 5, scrollX=T) )

3 An interactive manhattan plot


# Make the plot
p <- ggplot(don, aes(x=BPcum, y=-log10(P), text=text)) +
    
    # Show all points
    geom_point( aes(color=as.factor(CHR)), alpha=0.8, size=1.3) +
    scale_color_manual(values = rep(c("grey", "skyblue"), 22 )) +
    
    # custom X axis:
    scale_x_continuous( label = axisdf$CHR, breaks= axisdf$center ) +
    scale_y_continuous(expand = c(0, 0) ) +     # remove space between plot area and x axis

    # Add highlighted points
    geom_point(data=subset(don, is_highlight=="yes"), color="orange", size=2) +
  
    # Custom the theme:
    theme_bw() +
    theme( 
      legend.position="none",
      panel.border = element_blank(),
      panel.grid.major.x = element_blank(),
      panel.grid.minor.x = element_blank()
    ) +
    ylim(0, 10)

ggplotly(p, tooltip="text")



 
PCTGT

Created by Yan Holtz, adapted by Florian Rohart